package com.jappit.runtracker;

import java.util.Date;
import java.util.Vector;

import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;

import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;

import com.jappit.runtracker.data.DataManager;
import com.jappit.runtracker.model.Run;
import com.jappit.runtracker.screens.RunListScreen;
import com.jappit.runtracker.screens.SplashScreen;
import com.jappit.runtracker.utils.AppUtils;
import com.jappit.runtracker.utils.FormatUtils;
import com.nokia.maps.common.ApplicationContext;
import com.nokia.maps.common.GeoCoordinate;

public class RunTracker extends MIDlet {
	
	protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
		// TODO Auto-generated method stub

	}

	protected void pauseApp() {
		// TODO Auto-generated method stub

	}
	
	protected void startApp() throws MIDletStateChangeException
	{
		ApplicationContext ctx = ApplicationContext.getInstance();
    	ctx.setAppID("DPj-PO57zuc3cL-ExnbP");
        ctx.setToken("v6MkS%2FpFriZ5l43J%2BF8n7Q%3D%3D");
        
        AppUtils.getInstance().setMIDlet(this);
        
        /*Run r1 = new Run();
        r1.setStartDate(new Date());
        r1.setEndDate(new Date(r1.getStartDate().getTime() + 3600000));
        r1.setDistance(27000);
        double speed = r1.getAverageSpeed();
        System.out.println("S: " + speed + ", " + FormatUtils.formatSpeed(speed));
        */
        DataManager dataUtils = DataManager.getInstance();
        
        dataUtils.loadRuns();
        AppUtils.getInstance().gotoScreen(new SplashScreen());
	}
	

}
